/*LICENSE_BEGIN
 * ******************************************************************
 * All original parts of SoccerScope2003 have copyright (2003) by
 * Team YowAI, represented by Mr. Shuhei Shiota
 * The Department of Creative Informatics
 * The Graduate School of Information Science and Technology
 * The University of Tokyo
 * 
 * Additional classes (except libraries in /lib) were developed by 
 * the Dainamite Robocup-Team of the DAI-Labor, TU-Berlin 
 * (www.dai-labor.de)
 * 
 * Extended/new classes/packages are:
 *   soccerscope.analyzer.LogfileAnalyzer
 *   soccerscope.daistatistic.*
 *   soccerscope.daistatistic.charts.*
 *   soccerscope.daistatistic.tools.*
 *   soccerscope.db.*
 *   soccerscope.dialog.*
 *   soccerscope.model.PlayerWorldModel
 *   soccerscope.model.SimplePlayer
 *   soccerscope.net.AgentConnector
 *   soccerscope.training.*
 *   soccerscope.training.conditions.*
 * ******************************************************************
LICENSE_END*/
package soccerscope.daistatistic.charts;

import org.jfree.data.DomainOrder;
import org.jfree.data.general.DatasetChangeListener;
import org.jfree.data.general.DatasetGroup;
import org.jfree.data.xy.XYDataset;

public class XYDataset11SeriesImpl implements XYDataset {

	// the series name
	protected String seriesName0 = "1";

	protected String seriesName1 = "2";

	protected String seriesName2 = "3";

	protected String seriesName3 = "4";

	protected String seriesName4 = "5";

	protected String seriesName5 = "6";

	protected String seriesName6 = "7";

	protected String seriesName7 = "8";

	protected String seriesName8 = "9";

	protected String seriesName9 = "10";

	protected String seriesName10 = "11";

	// the x and y values
	double xValues[];

	double yValues0[];

	double yValues1[];

	double yValues2[];

	double yValues3[];

	double yValues4[];

	double yValues5[];

	double yValues6[];

	double yValues7[];

	double yValues8[];

	double yValues9[];

	double yValues10[];

	/**
	 * 
	 * set the series name of the chart
	 * 
	 * @param String
	 *            name
	 */
	public void setSeriesName(String name, int seriesNumber) {
		if (seriesNumber == 0)
			this.seriesName0 = name;
		if (seriesNumber == 1)
			this.seriesName1 = name;
		if (seriesNumber == 2)
			this.seriesName2 = name;
		if (seriesNumber == 3)
			this.seriesName3 = name;
		if (seriesNumber == 4)
			this.seriesName4 = name;
		if (seriesNumber == 5)
			this.seriesName5 = name;
		if (seriesNumber == 6)
			this.seriesName6 = name;
		if (seriesNumber == 7)
			this.seriesName7 = name;
		if (seriesNumber == 8)
			this.seriesName8 = name;
		if (seriesNumber == 9)
			this.seriesName9 = name;
		if (seriesNumber == 10)
			this.seriesName10 = name;
	}

	/**
	 * 
	 * set the y-values of the chart
	 * 
	 * @param double[]
	 *            y
	 */
	public void setYValues(double[] y, int forSeries) {
		if (forSeries == 0)
			this.yValues0 = y;
		if (forSeries == 1)
			this.yValues1 = y;
		if (forSeries == 2)
			this.yValues2 = y;
		if (forSeries == 3)
			this.yValues3 = y;
		if (forSeries == 4)
			this.yValues4 = y;
		if (forSeries == 5)
			this.yValues5 = y;
		if (forSeries == 6)
			this.yValues6 = y;
		if (forSeries == 7)
			this.yValues7 = y;
		if (forSeries == 8)
			this.yValues8 = y;
		if (forSeries == 9)
			this.yValues9 = y;
		if (forSeries == 10)
			this.yValues10 = y;

	}

	/**
	 * 
	 * set the x-values of the chart
	 * 
	 * @param double[]
	 *            x
	 */
	public void setXValues(double[] x) {
		this.xValues = x;
	}

	public DomainOrder getDomainOrder() {
		return DomainOrder.ASCENDING;
	}

	/**
	 * 
	 * returns the item count of the dataset
	 * 
	 * @param int
	 *            arg0, irrelevant: only one series is implemented so we can
	 *            return the length of the value array
	 */
	public int getItemCount(int arg0) {
		if (this.yValues1.length < this.xValues.length)
			return this.yValues1.length;
		else
			return this.xValues.length;
	}

	/**
	 * 
	 * irrelevant: used by jfreechart
	 */
	public Number getX(int arg0, int arg1) {
		return null;
	}

	/**
	 * 
	 * returns the xValue used by jfreechart
	 * 
	 * @param int
	 *            arg0, the serie - we have only one serie so we can directly
	 *            return the value of xValues[arg1]
	 * @param int
	 *            arg1, the wanted value
	 */
	public double getXValue(int arg0, int arg1) {

		return this.xValues[arg1];
	}

	/**
	 * 
	 * irrelevant: used by jfreechart
	 */
	public Number getY(int arg0, int arg1) {
		return null;
	}

	/**
	 * 
	 * returns the yValue used by jfreechart
	 * 
	 * @param int
	 *            arg0, the serie - we have only one serie so we can directly
	 *            return the value of yValues[arg1]
	 * @param int
	 *            arg1, the wanted value
	 */
	public double getYValue(int arg0, int arg1) {
		if (arg0 == 0)
			return this.yValues0[arg1];
		if (arg0 == 1)
			return this.yValues1[arg1];
		if (arg0 == 2)
			return this.yValues2[arg1];
		if (arg0 == 3)
			return this.yValues3[arg1];
		if (arg0 == 4)
			return this.yValues4[arg1];
		if (arg0 == 5)
			return this.yValues5[arg1];
		if (arg0 == 6)
			return this.yValues6[arg1];
		if (arg0 == 7)
			return this.yValues7[arg1];
		if (arg0 == 8)
			return this.yValues8[arg1];
		if (arg0 == 9)
			return this.yValues9[arg1];
		if (arg0 == 10)
			return this.yValues10[arg1];
		return 0;
	}

	/**
	 * 
	 * irrelevant: used by jfreechart
	 */
	public int getSeriesCount() {
		return 11;
	}

	/**
	 * 
	 * returns the series name used by jfreechart
	 * 
	 * @param int
	 *            arg0, the series number - we have only one serie so we can
	 *            directly return the only and one series name
	 */
	public String getSeriesName(int arg0) {
		if (arg0 == 0)
			return this.seriesName0;
		if (arg0 == 1)
			return this.seriesName1;
		if (arg0 == 2)
			return this.seriesName2;
		if (arg0 == 3)
			return this.seriesName3;
		if (arg0 == 4)
			return this.seriesName4;
		if (arg0 == 5)
			return this.seriesName5;
		if (arg0 == 6)
			return this.seriesName6;
		if (arg0 == 7)
			return this.seriesName7;
		if (arg0 == 8)
			return this.seriesName8;
		if (arg0 == 9)
			return this.seriesName9;
		if (arg0 == 10)
			return this.seriesName10;
		return "Error";
	}

	/**
	 * 
	 * irrelevant: not used until now
	 */
	public void addChangeListener(DatasetChangeListener arg0) {

	}

	/**
	 * 
	 * irrelevant: not used until now
	 */
	public void removeChangeListener(DatasetChangeListener arg0) {

	}

	/**
	 * 
	 * irrelevant: not used until now
	 */
	public DatasetGroup getGroup() {
		return null;
	}

	/**
	 * 
	 * irrelevant: not used until now
	 */
	public void setGroup(DatasetGroup arg0) {

	}

}


